<?php
include("../contents.php");
include("../security.php");
include("../settings.php");
include("../database.php");
include("../navigation.php");
if(!empty($_GET["showverwaltung"])) {
	if (Contents::presence_rights($_GET["showverwaltung"])) {
		$_SESSION["showverwaltung"][$_GET["showverwaltung"]]=1;
	}
}

if(!empty($_GET["hideverwaltung"])) {
	if (Contents::presence_rights($_GET["hideverwaltung"])) {
		$_SESSION["showverwaltung"][$_GET["hideverwaltung"]]=0;
	}
}

if(!empty($_GET["showmodules"])) {
	if (Contents::presence_rights($_GET["showmodules"])) {
		$_SESSION["showmodules"][$_GET["showmodules"]]=1;
	}
}

if(!empty($_GET["hidemodules"])) {
	if (Contents::presence_rights($_GET["hidemodules"])) {
		$_SESSION["showmodules"][$_GET["hidemodules"]]=0;
	}
}

if(!empty($_GET["showcmsverwaltung"])) {
	if (isset($_SESSION["showcmsverwaltung"]) && $_SESSION["showcmsverwaltung"]==1) {
		$_SESSION["showcmsverwaltung"]=0;
	} else {
		$_SESSION["showcmsverwaltung"]=1;
	}
}

if(!empty($_GET["showpresence"])) {
	if (Contents::presence_rights($_GET["showpresence"])) {
		$_SESSION["showpresence"][$_GET["showpresence"]]=1;
	}
}
if(!empty($_GET["hidepresence"])) {
	if (isset($_SESSION["showpresence"][$_GET["hidepresence"]]) && $_SESSION["showpresence"][$_GET["hidepresence"]]==1) {
		$_SESSION["showpresence"][$_GET["hidepresence"]]=0;
	}
}
echo "<"."?xml version=\"1.0\"?".">";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>Administration</title>
    <link media="screen" rel="stylesheet" href="css/style.css" type="text/css" />
  </head>

  <body style="background-color: #FFFFE7; padding:0px; padding-top:0px; margin:0px; border:0px; ">
  	<div style="padding-left:<?php echo $GLOBALS["einrueckung"]; ?>px; border:0px; ">&nbsp;</div>
  	<?php
  	$pres_user=mysql_query("SELECT * FROM ". $GLOBALS["db_pref"] ."users_presences WHERE user='". $_SESSION["userid"] ."'");
  	if (mysql_num_rows($pres_user)>0) {
  		for($i=0; $i<mysql_num_rows($pres_user); $i++) {
  			$row_pres=mysql_fetch_object($pres_user);
  			$pres_name=mysql_query("SELECT * FROM ". $GLOBALS["db_pref"] ."presences WHERE id='". $row_pres->presence ."'");
  			if (mysql_num_rows($pres_name)==1) {
  				$row_pres_name=mysql_fetch_object($pres_name);
  			?>
		<div style="border:0px; margin:0px; padding-top:0px; padding-left:0px; padding-bottom:0px; padding-left:<?php echo $GLOBALS["einrueckung"]; ?>px;">
  			<a href="<?php echo $_SERVER["PHP_SELF"]; ?>?<?php echo (isset($_SESSION["showpresence"][$row_pres_name->id]) && $_SESSION["showpresence"][$row_pres_name->id]==1)?"hide":"show";?>presence=<?php echo $row_pres_name->id; ?>">
			<img src="images/icons/folder<?php echo (isset($_SESSION["showpresence"][$row_pres_name->id]) && $_SESSION["showpresence"][$row_pres_name->id]==1)?"open":"";?>.gif" style="border:0px; width:19px; height:16px; padding-right: 6px;" />
			<?php echo $row_pres_name->name; ?></a><div style="padding-left:<?php echo $GLOBALS["einrueckung"]; ?>px; border:0px; line-height:7px;">&nbsp;</div>
			<?php
			if (isset($_SESSION["showpresence"][$row_pres_name->id]) && $_SESSION["showpresence"][$row_pres_name->id]==1) {
  		?>
  		<div style="border:0px; margin:0px; padding-top:0px; padding-left:0px; padding-bottom:0px; padding-left:<?php echo $GLOBALS["einrueckung"]; ?>px;">
  		<?php if (getright("content")) { ?>
		<?php list_navigation("content_dirs", $row_pres_name->id); echo "<br />"; }?>
		<?php if (getright("navigation")) { ?>
		<?php list_navigation("navigation", $row_pres_name->id); }
		$module=mysql_query("SELECT * FROM ". $GLOBALS["db_pref"] ."presences_modules WHERE presence='". $row_pres_name->id ."' ORDER by name");
		if(mysql_num_rows($module)>0) {
		?>
		<div style="padding-left:<?php echo $GLOBALS["einrueckung"]; ?>px; border:0px; line-height:7px;">&nbsp;</div>
		<div style="border:0px; margin:0px; padding-top:0px; padding-left:0px; padding-bottom:0px; padding-left:<?php echo $GLOBALS["einrueckung"]; ?>px;">
			<a href="<?php echo $_SERVER["PHP_SELF"]; ?>?<?php echo (isset($_SESSION["showmodules"][$row_pres_name->id]) && $_SESSION["showmodules"][$row_pres_name->id]==1)?"hide":"show";?>modules=<?php echo $row_pres_name->id; ?>">
			<img src="images/icons/folder<?php echo (isset($_SESSION["showmodules"][$row_pres_name->id]) && $_SESSION["showmodules"][$row_pres_name->id]==1)?"open":"";?>.gif" style="border:0px; width:19px; height:16px; padding-right: 6px;" />Module</a>
			<?php
			if (isset($_SESSION["showmodules"][$row_pres_name->id]) && $_SESSION["showmodules"][$row_pres_name->id]==1) {
			?>
			<div style="margin:0px; padding:0px; border:0px;">
				<?php
				for ($j=0; $j<mysql_num_rows($module); $j++) {
					$row_modules=mysql_fetch_object($module);
				?>
				<img src="images/icons/join<?php echo ($j==((mysql_num_rows($module))-1))?"":"bottom"; ?>.gif" style="border:0px; width:19px; height:16px; padding:0px; margin:0px;" /><a href="admin_modules.php?pres=<?php echo $row_pres_name->id; ?>&amp;module=<?php echo $row_modules->name; ?>" target="main"><img src="images/icons/page.gif" style="border:0px; width:19px; height:16px; padding-right: 6px;" /><?php echo $row_modules->name; ?></a><br />
				<?php
				}
				?>
			</div>
			<?php
			}
			?>
		</div>
		<?php
		}
		?>
		<?php if (getright("verwaltung")) { ?>
		<div style="padding-left:<?php echo $GLOBALS["einrueckung"]; ?>px; border:0px; line-height:7px;">&nbsp;</div>
		<div style="border:0px; margin:0px; padding-top:0px; padding-left:0px; padding-bottom:0px; padding-left:<?php echo $GLOBALS["einrueckung"]; ?>px;">
			<a href="<?php echo $_SERVER["PHP_SELF"]; ?>?<?php echo (isset($_SESSION["showverwaltung"][$row_pres_name->id]) && $_SESSION["showverwaltung"][$row_pres_name->id]==1)?"hide":"show";?>verwaltung=<?php echo $row_pres_name->id; ?>">
			<img src="images/icons/folder<?php echo (isset($_SESSION["showverwaltung"][$row_pres_name->id]) && $_SESSION["showverwaltung"][$row_pres_name->id]==1)?"open":"";?>.gif" style="border:0px; width:19px; height:16px; padding-right: 6px;" />Verwaltung</a>
			<?php
			if (isset($_SESSION["showverwaltung"][$row_pres_name->id]) && $_SESSION["showverwaltung"][$row_pres_name->id]==1) {
			?>
			<div style="margin:0px; padding:0px; border:0px;">
				<?php if (getright("verwaltung_media")) { ?>
				<img src="images/icons/joinbottom.gif" style="border:0px; width:19px; height:16px; padding:0px; margin:0px;" /><a href="admin_upload.php?pres=<?php echo $row_pres_name->id; ?>" target="main"><img src="images/icons/page.gif" style="border:0px; width:19px; height:16px; padding-right: 6px;" />Medien</a><br />
				<?php } ?>
				<?php if (getright("verwaltung_cache")) { ?>
				<img src="images/icons/joinbottom.gif" style="border:0px; width:19px; height:16px; padding:0px; margin:0px;" /><a href="admin_cache.php?pres=<?php echo $row_pres_name->id; ?>"><img src="images/icons/page.gif" style="border:0px; width:19px; height:16px; padding-right: 6px;" />Cache leeren</a><br />
				<?php } ?>
				<?php if (getright("verwaltung_settings")) { ?>
				<img src="images/icons/joinbottom.gif" style="border:0px; width:19px; height:16px; padding:0px; margin:0px;" /><a href="admin_settings.php?pres=<?php echo $row_pres_name->id; ?>" target="main"><img src="images/icons/page.gif" style="border:0px; width:19px; height:16px; padding-right: 6px;" />Einstellungen</a><br />
				<?php } ?>
				<?php if (getright("verwaltung_webusers")) { ?>
				<img src="images/icons/join.gif" style="border:0px; width:19px; height:16px; padding:0px; margin:0px;" /><a href="admin_webusers.php?pres=<?php echo $row_pres_name->id; ?>" target="main"><img src="images/icons/page.gif" style="border:0px; width:19px; height:16px; padding-right: 6px;" />Webbenutzer</a>
				<?php } ?>
			</div>
			<?php
			}
			?>
		</div>
		<?php
		}
		?>
		</div>
			<?php
			}
			?>
		</div><br />
	<?php
  			}
  		}
  	}
  	
  	$get_user_pref=mysql_query("SELECT id FROM ". $GLOBALS["db_pref"] ."users WHERE id='". $_SESSION["userid"] ."' and global_verwaltung='1'");
  	if (mysql_num_rows($get_user_pref)==1) {
	?>
	<div style="border:0px; margin:0px; padding-top:0px; padding-left:0px; padding-bottom:0px; padding-left:<?php echo $GLOBALS["einrueckung"]; ?>px;">
		<a href="<?php echo $_SERVER["PHP_SELF"]; ?>?showcmsverwaltung=1">
		<img src="images/icons/folder<?php echo (isset($_SESSION["showcmsverwaltung"]) && $_SESSION["showcmsverwaltung"]==1)?"open":"";?>.gif" style="border:0px; width:19px; height:16px; padding-right: 6px;" />
		CMS-Verwaltung</a>
		<?php
		if (isset($_SESSION["showcmsverwaltung"]) && $_SESSION["showcmsverwaltung"]==1) {
		?>
		<div style="margin:0px; padding:0px; border:0px;">
			<img src="images/icons/joinbottom.gif" style="border:0px; width:19px; height:16px; padding:0px; margin:0px;" /><a href="admin_users.php" target="main"><img src="images/icons/page.gif" style="border:0px; width:19px; height:16px; padding-right: 6px;" />Benutzer</a><br />
			<img src="images/icons/join.gif" style="border:0px; width:19px; height:16px; padding:0px; margin:0px;" /><a href="admin_pres.php" target="main"><img src="images/icons/page.gif" style="border:0px; width:19px; height:16px; padding-right: 6px;" />Pr&auml;senzen</a>
		</div>
		<?php
		}
		?>
	</div><br />
	<?php
  	}
	?>
  	<div style="padding-left:<?php echo $GLOBALS["einrueckung"]; ?>px;">
  		<img src="images/icons/page.gif" style="border:0px; width:19px; height:16px; padding-right: 6px;" /><a href="logout.php" target="_top" class="menu">Logout</a>
  	</div>
  </body>
</html>
<?php

?>